function service(options = {}) {
	options.url = `${options.url}`;

	// resolved是返回成功数据，rejected返回错误数据
	return new Promise((resolved, rejected) => {
		options.success = (res) => {
			resolved(res.data)
		};
		options.fail = (err) => {
			console.log("请求错误",err);
			// 请求失败弹窗
			uni.showToast({
				duration: 5000,
				title: "服务器开小差了~"
			});
			rejected(err);
		};

		uni.request(options);
	});
}

export default service;